﻿@model PersonalWebsite.Models.Article

<link href="~/Lib/Markdown/css/editormd.css" rel="stylesheet" />
<link href="~/Lib/Markdown/css/editormd.preview.css" rel="stylesheet" />
<script src="~/Lib/Markdown/js/editormd.js"></script>

<script>
    $(function () {
        testEditor = editormd("test-editormd", {
            width: "99%",
            height: 640,
            syncScrolling: "single",
            path: "/Lib/Markdown/lib/",
            saveHTMLToTextarea: true,
            emoji: true
        });
    });

    function btnSave() {
        document.getElementById("hiddenContent").value = encodeURI(testEditor.getHTML());
        document.getElementById("hiddenContent1").value = encodeURI(testEditor.getMarkdown());
    }
</script>

<body class="c1">

    <div id="container">

        <div id="contents">

            <div id="main">

                <section>

                    @using (Html.BeginForm())
                    {
                        @Html.AntiForgeryToken()
                        @Html.ValidationSummary(true)
                        string[] ArticleContent = Model.ArticleContent.Split('猋');
                        string Markdown = Model.Markdown;

                        <h2>Edit</h2>
                        <div id="test-editormd">
                            @Html.TextArea("articleContent", Markdown)
                            <input type="hidden" id="hiddenDate" name="hiddenDate" value="@Model.ArticleDate" />
                            <input type="hidden" id="hiddenID" name="hiddenID" value="@Model.ArticleID" />
                            <input type="hidden" id="hiddenContent" name="hiddenContent" />
                            <input type="hidden" id="hiddenContent1" name="hiddenContent1" />
                            <!--<textarea id="articleContent" style="display: none;"></textarea>-->
                        </div>
                        <center>
                            <div id="settings">
                                Article Title: @Html.TextBox("title", ArticleContent[0])<br />
                                Article Type: @Html.TextBoxFor(model => model.ArticleType, new { @style = "size: 30" })
                            </div>
                            <input class="btn" type="submit" onclick="btnSave()" value="Save" />
                        </center>
                    }
                    <!--
                    <h2>Edit</h2>
                    <div id="test-editormd">
                        <textarea id="articleContent" style="display: none;">Html.Raw(Model.ArticleContent.Split('猋')[1])</textarea>
                    </div>
                    <center><input class="btn" type="submit" onclick="btnSave()" value="Save" /></center>
                    -->
                </section>

            </div>
            <!--/#main-->

            <div id="sub">

            </div>
            <!--/#sub-->

        </div>
        <!--/#contents-->

        <footer>
        </footer>

    </div>
    <!--/#container-->

    <!--ページの上部に戻る「↑」ボタン-->
    <p class="nav-fix-pos-pagetop"><a href="#">↑</a></p>

    <!--メニュー開閉ボタン-->
    <div id="menubar_hdr" class="close"></div>

    <!--メニューの開閉処理条件設定　900px以下-->
    <script>
        if (OCwindowWidth() <= 900) {
            open_close("menubar_hdr", "menubar-s");
        }
    </script>

    <!--パララックス用ファイル読み込み-->
    <script src="js/jquery.inview.js"></script>
    <script src="js/jquery.inview_set.js"></script>

</body>